﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PloobsEngine.SceneControl;
using PloobsEngine.Physics;
using PloobsEngine;
using PloobsEngine.Cameras;
using PloobsEngine.Input;
using Microsoft.Xna.Framework;
using PloobsEngine.Physics.Bepu;
using PloobsEngine.Modelo;
using PloobsEngine.Material;
using Microsoft.Xna.Framework.Graphics;
using PloobsEngine.Utils;
using PloobsEngine.Features;
using PloobsEngine.Commands;
using PloobsEngine.Light;
using Etapa1.SofRender;

namespace Etapa1.Screens
{
    public class TesScreen : IScreen
    {        

        public TesScreen(EngineStuff es)
        {
        }        
        Device11 device;

        public override void LoadContent(EngineStuff es)
        {
            device = new Device11();
            base.LoadContent(es);
        }

        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            device.Clear(Color.Red, 1);            

            VertexType v0 = new VertexType();
            VertexType v1 = new VertexType();
            VertexType v2 = new VertexType();

            v0[Slots.POSITION0] = new Vector4(0.5f, 1, 0, 1);
            v1[Slots.POSITION0] = new Vector4(0, 0, 0, 1);
            v2[Slots.POSITION0] = new Vector4(1, 0, 0, 1);         
            
            device.SetVertexBuffer(new VertexType[] {v0,v1,v2});
            device.SetEffect(new TesShader());            
            device.DrawPrimitive(PrimitivesType.PatchWith3ControlPoints);

            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
        }

        public override void Draw(GameTime gameTime)
        {
            device.Draw();
            base.Draw(gameTime);

        }
    }
}

